﻿@{
    ViewBag.Title = "Расписание аудиторий";
}

@section scripts {
    @Content.Script(this, "~/Scripts/Site/schedule.auditorium.viewmodel.js")
}

<div class="courses-list">
    <ul class="nav">
        <li class="light-blue active">
            <a href="#">Расписание для: <b><span data-bind="text: currentBuilding().Name == undefined ? '<Выберите корпус>' : currentBuilding().Name"></span></b>, <b><span data-bind="text: currentAuditorium().Number == undefined ? '<Укажите аудиторию>' : currentAuditorium().Number"></span></b> ауд. </a> 
        </li>
    </ul>    
</div>



@Content.Navbar("scheduleAuditoriumLink", this)
@Html.Partial("Auditorium/_BuildingList");
@Content.Toolbar(action: () => Html.RenderPartial("Auditorium/_AuditoriumSearch"))

<div class="modal" id="emptyAuditoriumNum" style="margin-top: 0px;" data-bind="css: { 'hide': currentAuditorium().Number !== undefined }">
  <div class="modal-body" style="text-align: center">
    <p><h2>Номер аудитории не указан...</h2></p>
  </div>
</div>

<div class="content">
    <table class="table table-striped table-bordered table-condensed" style="width: 100%; margin-bottom: 0px;">
        <thead>
            <tr>
                <th style="width: 75px;" rowspan="2">
                    Время
                </th>
                <th colspan="6">
                    Дни недели
                </th>
            </tr>
            <tr data-bind="foreach: weekDayDates">
                <th data-bind="text: date">
                </th>
            </tr>
        </thead>
        <tbody data-bind="foreach: times">
            <tr>
                <td data-bind="html: '<b>' + StartTime + '</b> - <b>' + EndTime + '</b>'" style="width: 75px;">                    
                </td>
                <td data-bind="css: { 'active' : $root.currentDay().getDay() == 1}, attr: { 'data-periodid': $index(), 'data-scheduleid': $root.schedule()[0][$index()].Id }, event : { dblclick: $root.showDialog, click: $root.scheduleTicketClick }" data-dayOfWeek="1" style="cursor: pointer;">
                    <div data-bind="if: $root.schedule()[0][$index()].Id !== undefined">
                        <p><b><span data-bind="text: $root.schedule()[0][$index()].TutorialName"></span></b> (<span data-bind="text: $root.schedule()[0][$index()].TutorialTypeName"></span>)</p>
                        <p><b><span data-bind="text: $root.schedule()[0][$index()].FacultyName"></span></b>, <b><span data-bind="text: $root.schedule()[0][$index()].CourseName"></span></b>, <b><span data-bind="text: $root.schedule()[0][$index()].GroupCode"></span></b></p>
                        <p><b><span data-bind="text: $root.schedule()[0][$index()].Lecturer"></span></b></p>
                    </div>
                </td>
                <td data-bind="css: { 'active' : $root.currentDay().getDay() == 2}, attr: { 'data-periodid': $index(), 'data-scheduleid': $root.schedule()[1][$index()].Id }, event : { dblclick: $root.showDialog, click: $root.scheduleTicketClick }" data-dayOfWeek="2" style="cursor: pointer;">
                    <div data-bind="if: $root.schedule()[1][$index()].Id !== undefined">
                        <p><b><span data-bind="text: $root.schedule()[1][$index()].TutorialName"></span></b> (<span data-bind="text: $root.schedule()[1][$index()].TutorialTypeName"></span>)</p>
                        <p><b><span data-bind="text: $root.schedule()[1][$index()].FacultyName"></span></b>, <b><span data-bind="text: $root.schedule()[1][$index()].CourseName"></span></b>, <b><span data-bind="text: $root.schedule()[1][$index()].GroupCode"></span></b></p>
                        <p><b><span data-bind="text: $root.schedule()[1][$index()].Lecturer"></span></b></p>
                    </div>
                </td>
                <td data-bind="css: { 'active' : $root.currentDay().getDay() == 3}, attr: { 'data-periodid': $index(), 'data-scheduleid': $root.schedule()[2][$index()].Id }, event : { dblclick: $root.showDialog, click: $root.scheduleTicketClick }" data-dayOfWeek="3" style="cursor: pointer;">
                    <div data-bind="if: $root.schedule()[2][$index()].Id !== undefined">
                        <p><b><span data-bind="text: $root.schedule()[2][$index()].TutorialName"></span></b> (<span data-bind="text: $root.schedule()[2][$index()].TutorialTypeName"></span>)</p>
                        <p><b><span data-bind="text: $root.schedule()[2][$index()].FacultyName"></span></b>, <b><span data-bind="text: $root.schedule()[2][$index()].CourseName"></span></b>, <b><span data-bind="text: $root.schedule()[2][$index()].GroupCode"></span></b></p>
                        <p><b><span data-bind="text: $root.schedule()[2][$index()].Lecturer"></span></b></p>
                    </div>
                </td>                
                <td data-bind="css: { 'active' : $root.currentDay().getDay() == 4}, attr: { 'data-periodid': $index(), 'data-scheduleid': $root.schedule()[3][$index()].Id }, event : { dblclick: $root.showDialog, click: $root.scheduleTicketClick }" data-dayOfWeek="4" style="cursor: pointer;">
                    <div data-bind="if: $root.schedule()[3][$index()].Id !== undefined">
                        <p><b><span data-bind="text: $root.schedule()[3][$index()].TutorialName"></span></b> (<span data-bind="text: $root.schedule()[3][$index()].TutorialTypeName"></span>)</p>
                        <p><b><span data-bind="text: $root.schedule()[3][$index()].FacultyName"></span></b>, <b><span data-bind="text: $root.schedule()[3][$index()].CourseName"></span></b>, <b><span data-bind="text: $root.schedule()[3][$index()].GroupCode"></span></b></p>
                        <p><b><span data-bind="text: $root.schedule()[3][$index()].Lecturer"></span></b></p>
                    </div>
                </td>
                <td data-bind="css: { 'active' : $root.currentDay().getDay() == 5}, attr: { 'data-periodid': $index(), 'data-scheduleid': $root.schedule()[4][$index()].Id }, event : { dblclick: $root.showDialog, click: $root.scheduleTicketClick }" data-dayOfWeek="5" style="cursor: pointer;">
                    <div data-bind="if: $root.schedule()[4][$index()].Id !== undefined">
                        <p><b><span data-bind="text: $root.schedule()[4][$index()].TutorialName"></span></b> (<span data-bind="text: $root.schedule()[4][$index()].TutorialTypeName"></span>)</p>
                        <p><b><span data-bind="text: $root.schedule()[4][$index()].FacultyName"></span></b>, <b><span data-bind="text: $root.schedule()[4][$index()].CourseName"></span></b>, <b><span data-bind="text: $root.schedule()[4][$index()].GroupCode"></span></b></p>
                        <p><b><span data-bind="text: $root.schedule()[4][$index()].Lecturer"></span></b></p>
                    </div>
                </td>
                <td data-bind="css: { 'active' : $root.currentDay().getDay() == 6}, attr: { 'data-periodid': $index(), 'data-scheduleid': $root.schedule()[5][$index()].Id }, event : { dblclick: $root.showDialog, click: $root.scheduleTicketClick }" data-dayOfWeek="6" style="cursor: pointer;">
                    <div data-bind="if: $root.schedule()[5][$index()].Id !== undefined">
                        <p><b><span data-bind="text: $root.schedule()[5][$index()].TutorialName"></span></b> (<span data-bind="text: $root.schedule()[5][$index()].TutorialTypeName"></span>)</p>
                        <p><b><span data-bind="text: $root.schedule()[5][$index()].FacultyName"></span></b>, <b><span data-bind="text: $root.schedule()[5][$index()].CourseName"></span></b>, <b><span data-bind="text: $root.schedule()[5][$index()].GroupCode"></span></b></p>
                        <p><b><span data-bind="text: $root.schedule()[5][$index()].Lecturer"></span></b></p>
                    </div>
                </td>
            </tr>
        </tbody>
    </table>    
</div>

@{Html.RenderPartial("Auditorium/_AddEdit");}